<?php
function validateEmail($email)
{
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        return "Invalid email format";
      }
}

function validateWebsite($website)
{
    $url_validation_regex = "/^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$/";

    if (!preg_match($url_validation_regex, $website)) 
    {
        return "The website url should look like this: http://www.site.com";
    }
}

function validatePhone($phone)
{
    $result = '';

    if (strlen($phone) < 10)
    {
        $result = "Phone length should be more than 10 symbols";
    }
    if (!is_numeric($phone))
    {
        $result = $result . " Phone number have to contain only numbers";
    }
    
    return $result;
}

function validateUserInfo($user)
{
    $errors = [];   
    $errors['email'] = validateEmail($user['email']);
    $errors['phone'] = validatePhone($user['phone']);
    $errors['website'] = validateWebsite($user['website']);

    return $errors;
}